/**
 * Copyright (C) 2010 Regis Montoya (aka r3gis - www.r3gis.fr)
 * This file is part of CSipSimple.
 *
 *  CSipSimple is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  CSipSimple is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with CSipSimple.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.csipsimple.wizards.impl;

import android.preference.EditTextPreference;
import android.text.InputType;

import com.wellcomcall.R;
import com.csipsimple.api.SipConfigManager;
import com.csipsimple.api.SipProfile;
import com.csipsimple.utils.PreferencesWrapper;

//import com.csipsimple.wizards.impl.PhoneData;

public class Mondotalk extends SimpleImplementation {
//public class Mondotalk extends AuthorizationImplementation {
	public String uname;

	@Override
	protected String getDomain() {
		return "wellcom.callbuzz.net:5090";
	}
	
	@Override
	protected String getDefaultName() {
		return "WellComCall";
	}
	
	@Override
	public void setDefaultParams(PreferencesWrapper prefs) {
		super.setDefaultParams(prefs);
		//TODO : when codec per network feature will be there set that for wifi
		prefs.setCodecPriority("G729/8000/1", SipConfigManager.CODEC_WB, "245");
		prefs.setCodecPriority("G722/16000/1",SipConfigManager.CODEC_WB, "243");
		prefs.setCodecPriority("PCMU/8000/1",SipConfigManager.CODEC_WB, "244");
		
		prefs.setCodecPriority("G729/8000/1", SipConfigManager.CODEC_NB, "245");
		prefs.setCodecPriority("G722/16000/1",SipConfigManager.CODEC_NB, "234");
		prefs.setCodecPriority("PCMU/8000/1",SipConfigManager.CODEC_NB, "244");
	}
	
	public void setname(String name){
		uname = name;
	}
	@Override
	public void fillLayout(SipProfile account) {
		super.fillLayout(account);

		accountUsername.setTitle(R.string.w_common_phone_number);
		accountUsername.setDialogTitle(R.string.w_common_phone_number);
		accountUsername.getEditText().setInputType(InputType.TYPE_CLASS_PHONE);
		accountUsername.setText(account.username);
		accountPassword.setText(account.data);
		
//		accountUsername.setTitle(R.string.w_common_password);
//		accountUsername.setDialogTitle(R.string.w_common_password);
//		accountUsername.getEditText().setInputType(InputType.TYPE_CLASS_PHONE);
		//accountUsername.setText(account.);
		//static String agent = account.username+"wellcom.callbuzz.net"+"Stu250i";
		//PreferencesWrapper.setUserAgent(agent);
		//prefWrapper.setUserAgent(md5(agent));
		//accountUsername.setText("0838833133");
	}
	
	public SipProfile buildAccount(SipProfile account) {
		account = super.buildAccount(account);
		account.transport = SipProfile.TRANSPORT_TCP;
		account.reg_timeout = 300;
		return account;
	}
	
	@Override
	protected boolean canTcp() {
		return false;
	}
	
}
